<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>我的购物车</title>

  </head>
  <body>
  <a href="prod.jspx">←返回继续购物</a>
  <table border="1px" width="70%">
  	<tr>
  	<td>商品名称</td><td>商品单价</td><td>数量</td><td>总价</td><td>操作</td>
  	</tr>
  <c:if test="${empty sessionScope.shopCar }">
  	<tr><td colspan="5">您的购物车还是空的，赶紧<a href="prod.jspx">购物</a>吧!</td></tr>
  </c:if>
  <c:forEach items="${sessionScope.shopCar }" var="item">
  	<c:set var="total" value="${pageScope.total+item.total }"/>
  	<tr>
  	<td>${item.prod.prodname }</td>
  	<td>${item.prod.price }</td>
  	<td>
  	<form action="shopcar.jspx?m=updatecar" method="post">
  	<input type="hidden" name="id" value="${item.prod.id }" />
  	<input type="text" style="width:40px;" name="num" value="${item.num }" />
  	<input type="submit" value="修改"/>
  	</form>
  	</td>
  	<td>${item.total }</td>
  	<td>
	<a href="shopcar.jspx?m=delcar&id=${item.prod.id }">删除</a>
	</td>
  	</tr>
  </c:forEach>
  </table>
  <h1>总共付:￥${pageScope.total }</h1>
  
  <a href="order.jspx?m=addorder">结算</a>
  </body>
</html>
